package com.atguigu.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: cloud2020
 * @description: TODO
 * @author: YuWenYi
 * @create: 2021-04-16 11:08
 **/
@RestController
@RefreshScope
//开启配置自动刷新功能!但是想要获取这个更新值,
// 还需要发送一个post请求http://localhost:3355/actuator/refresh去通知3355客户端
public class ConfigController {
    /**
     * 这里取的值是从github上取回来的
     */
    @Value("${config.info}")
    private String configInfo;

    @Value("${server.port}")
    private String serverPort;

    @RequestMapping("/configInfo")
    public String test(){
        return "server port : "+serverPort+"\t configInfo : "+configInfo ;
    }
}
